package HUZ_FileIO;

import java.io.File;
import java.io.IOException;

public class demo2 {
    public static void main(String[] args) throws IOException {
        //指定文件路径的目录及文件(多种文本)生成方式
//        File file1=new File("E:\\Java网络通信程序\\testDemo1\\file.txt");
//        File file2=new File("E:\\Java网络通信程序\\testDemo1\\dirTest");
//
//        String parent= file1.getParent();
//        String path = file1.getPath();
//        String name = file1.getName();
//
//        System.out.println("file1父路径："+parent);
//        System.out.println("file1 path："+path);
//        System.out.println("file1 name："+name);


        File file1=new File("E:\\Java网络通信程序\\testDemo2\\test.txt");
        File file2=new File("E:\\Java网络通信程序\\testDemo2");

//        File file1=new File("E:\\Java网络通信程序\\testDemo1","TestDemo.txt");
//        File file2=new File("E:\\Java网络通信程序\\testDemo1","dirDemo");

        String parent= file1.getParent();
        String path = file1.getPath();
        String name = file1.getName();
        String parent1= file2.getParent();
        String path1 = file2.getPath();
        String name1 = file2.getName();

        System.out.println("file1父路径："+parent);
        System.out.println("file1 path："+path);
        System.out.println("file1 name："+name);
        System.out.println();
        System.out.println("file2父路径："+parent1);
        System.out.println("file2 path："+path1);
        System.out.println("file2 name："+name1);

        System.out.println("==============");
        System.out.println(file1.isFile());
        System.out.println(file2.isDirectory());
        System.out.println("================");

        file2.mkdir();
        file1.createNewFile();

        System.out.println(file1.isFile());
        System.out.println(file2.isDirectory());
        System.out.println("================");



    }
}
